package com.demo.controller;

import com.alibaba.fastjson.JSON;
import com.demo.dto.TaskQueryResultRequestDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/order/loan/task/loan")
@Slf4j
@Api(tags = {"机构bus 获取放款结果任务"}, produces = "application/json")
public class BusLoanTaskController  {


    @ApiOperation(value = "机构bus放款结果查询任务接口", httpMethod = "POST", notes = "机构bus放款结果查询任务接口")
    @PostMapping("/query/result/bus")
    public String queryMakeResultBus(@Validated @RequestBody  TaskQueryResultRequestDTO taskQueryResultRequestDTO,
                                  BindingResult bindingResult, HttpServletResponse response) {
        log.info("机构bus放款结果查询任务接口入参：{}", JSON.toJSONString(taskQueryResultRequestDTO));
        if (bindingResult.hasErrors()) {
            throw new RuntimeException(bindingResult.getFieldError().getDefaultMessage());
        } else {
            String a = "aaaaa";
            return a;
            //taskBusLoanService.dealLoanResultTaskBusinessBus(taskQueryResultRequestDTO);
        }
    }
}
